package com.yuneec.droneservice.command;

import com.MAVLink.yuneec.msg_mav_rc_cmd_ack;
import com.yuneec.droneservice.request.IResponse;

/**
 * Created by gjw on 2017/3/27.
 */

public class Calibrate extends BaseCommand {
    private final byte op;

    private Calibrate(byte op) {
        super(MAV_RC_COMMAND.MAV_RC_CMD_CALIBRATE);
        this.op = op;
    }

    public static Calibrate startCalibrateCmd() {
        byte op = 0x01;
        return new Calibrate(op);
    }

    public static Calibrate stopCalibrateCmd() {
        byte op = 0x00;
        return new Calibrate(op);
    }


    @Override
    protected short[] body() {
        return new short[]{(short) (op & 0xff)};
    }

    @Override
    public IResponse toResponse(msg_mav_rc_cmd_ack ack) {
        return new IResponse(ids(), ack.code);
    }
}
